import *as actionType from './actionType'
import axios from 'axios'
import { fromJS } from 'immutable';

export const handeritem=()=>({
    type:actionType.HEANDER_ITEM
})

export const mouseIn=()=>({
    type:actionType.MOUSE_IN
})

export const mouseOut=()=>({
    type:actionType.MOUSE_OUT
})

export const additem=()=>({
    type:actionType.ADD_ITEM
})

export const changelist =(page)=>({
    type:actionType.CHANGE_LIST,
    page
})

const handerList=(data)=>({
    type:actionType.HANDER_LIST,
    data:fromJS(data),
    totalPage: data.length / 10
})

export const getList =()=>{
    return (dispatch)=>{
        axios.get('api/headerList.json').then((res)=>{
            const data=res.data
            dispatch(handerList(data))
        })
    }
}
